#linux #unix #command line #terminal #shell #zsh #bash

Using sudo with user dotfiles and aliases

Published Feb 18, 2020 by Alex C-G


The Problem

I’m a terminal junkie, and a heavy user of Neovim. This leads to a couple of issues when I’m using sudo:

What I Want

What I want: I type sudo vim and it opens up Neovim with my user settings

The Solution

I’ve finally worked out a fix. In your .zshrc (or .bashrc or .whateverrc) file:

alias sudo='nocorrect sudo -E '

Now, when I type sudo vim foo.txt, it brings up Neovim with my own settings!

Breaking It Down

Notes



*****

© 2018-2024, Alex Cureton-Griffiths